'''
* This is the projet for Brtc LlmOps Platform
* @Author Leon-liao <liaosiliang@alltman.com>
* @Description //TODO 
* @File: app.py
* @Time: 2025/9/17
* @All Rights Reserve By Brtc
'''
import dotenv
from aiohttp.web_middlewares import middleware
from flask_login import LoginManager
from flask_migrate import Migrate
from injector import Injector
from config.config import Config
from internal.middleware.middleware import Middleware
from internal.router.router import Router
from internal.server.http import Http
from pkg.sqlachemy.sqlalchemy import SQLAlchemy
from .module import  app_injector

#环境变量
dotenv.load_dotenv()

# flask app 的配置
app_config = Config()

#flask  http 服务
run_app = Http(__name__,
               config = app_config,
               db = app_injector.get(SQLAlchemy),
               migrate = app_injector.get(Migrate),
               login_manager = app_injector.get(LoginManager),
               middleware = app_injector.get(Middleware),
               router = app_injector.get(Router))
# celery 协程
celery = run_app.extensions["celery"]

# app 主进程
if __name__ == "__main__":
    run_app.run(debug=True)
